Cleaning scripts:

Load data:

Visualize probability ratings

exp_trials = rbind(exp_trials2, exp_trials3, exp_trials4)

exp_trials$prob = factor(exp_trials$prob)

ggplot(data = exp_trials) +
  geom_boxplot(mapping = aes(x = prob, y = prob_rating, fill = prob))

Visualize mood ratings

mood2 = format_mood(read.csv("../data/04_exp_away_cond2-mood_ratings.csv"))
mood2$Answer.condition = "Confident"
mood3 = format_mood(read.csv("../data/04_exp_away_cond3-mood_ratings.csv"))
mood3$Answer.condition = "Pessimist"
mood4 = format_mood(read.csv("../data/04_exp_away_cond4-mood_ratings.csv"))
mood4$Answer.condition = "Cautious"

mood3$workerid = mood3$workerid + max(mood2$workerid) + 1
mood4$workerid = mood4$workerid + max(mood3$workerid) + 1

mood_all = rbind(mood2, mood3, mood4)

mood1_all = mood_all %>%
  filter(type == "mood1") %>%
  mutate(mood1 = mood_rating) %>%
  mutate(mood_rating = NULL) %>%
  mutate(type = NULL)

mood2_all = mood_all %>%
  filter(type == "mood2") %>%
  mutate(mood2 = mood_rating) %>%
  mutate(mood_rating = NULL) %>%
  mutate(type = NULL)


mood_all = merge(mood1_all, mood2_all)

mood_by_participant = mood_all

mood_by_participant$diff = mood_all$mood2 - mood_all$mood1

moodp1 = ggplot(data = mood_by_participant) +
  geom_bar(mapping = aes(x = workerid, y = diff, fill = Answer.condition), stat = "identity")

moodp1

Exclude random responses

exclude_random = function(d) {
  d_overall_means = d %>%
  group_by(modal, workerid) %>% 
  summarise(rating_m_overall = mean(rating))

  d_indiv_means =  d %>%
    group_by(modal,percent_window, workerid) %>% 
    summarise(rating_m = mean(rating))
  
  d_indiv_merged = merge(d_indiv_means, d_overall_means, by=c("workerid", "modal"))
  
  cors = d_indiv_merged %>%
    group_by(workerid) %>%
    summarise(corr = cor(rating_m, rating_m_overall))
  
  exclude = cors %>%
    filter(corr > 0.75) %>%
    .$workerid
  
  print(paste("Excluded", length(exclude), "participants based on random responses."))
  
  d = d %>% filter(!(workerid %in% exclude))
}

d2 = exclude_random(d2)
## [1] "Excluded 11 participants based on random responses."
d3 = exclude_random(d3)
## [1] "Excluded 9 participants based on random responses."
d4 = exclude_random(d4)
## [1] "Excluded 14 participants based on random responses."

Aggregated results

## Individual plots

plot(ps2$by_participant)

plot(ps3$by_participant)

plot(ps4$by_participant)

AUC Computation

In the first t-test below, we see whether or not the difference in the AUC for the cautious speaker is significantly greater than that of the confident speaker. This allows us to see whether or not the speakers adapt to a specific speaker’s modal usage during the exposure phase.

## 
##  Two Sample t-test
## 
## data:  aucs.confident$auc_diff and aucs.cautious$auc_diff
## t = -5.1755, df = 133, p-value = 8.188e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -21.21955  -9.48492
## sample estimates:
## mean of x mean of y 
##  1.615644 16.967878

In this second t-test, we see whether the difference in the AUC for the pessimistic speaker is significantly less than that of the cautious speaker. This allows us to see whether or not explaining-away has occurred.

## 
##  Two Sample t-test
## 
## data:  aucs.pessimist$auc_diff and aucs.cautious$auc_diff
## t = -2.3787, df = 135, p-value = 0.01878
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -15.801590  -1.454392
## sample estimates:
## mean of x mean of y 
##  8.339888 16.967878